const TYPE_ERROR = {
    NUMBER: TypeError("param type must be Number"),
    BOOLEAN: TypeError("param type must be Boolean"),
    STRING: TypeError("param type must be String"),
    OBJECT: TypeError("param type must be Object"),
    ARRAY: TypeError("param type must be Array")
};

const logger = (() => {
    function dateFormat(date, pattern) {
        var returnValue = pattern;
        var format = {
            'y+': date.getFullYear(),
            'M+': date.getMonth() + 1,
            'd+': date.getDate(),
            'H+': date.getHours(),
            'm+': date.getMinutes(),
            's+': date.getSeconds(),
            'S': date.getMilliseconds(),
            'h+': (date.getHours() % 12),
            'a': (date.getHours() / 12) <= 1 ? 'AM' : 'PM'
        };
        for (var key in format) {
            var regExp = new RegExp('(' + key + ')');
            if (regExp.test(returnValue)) {
                var zero = '';
                for (var i = 0; i < RegExp.$1.length; i++) { zero += '0'; }
                var replacement = RegExp.$1.length == 1 ? format[key] : (zero + format[key]).substring((('' + format[key]).length));
                returnValue = returnValue.replace(RegExp.$1, replacement);
            }
        }
        return returnValue;
    };
    function paramsResolve(params = []) {
        return params.map(param => {
            return param;
        });
    }
    function generatePrefix(level) {
        return `[${dateFormat(new Date(), "yyyy-MM-dd HH:mm:ss.S")}][${level}]`;
    }
    function info(...params) {
        console.info(generatePrefix("INFO"), ...paramsResolve(params));
    }
    function fatal(...params) {
        console.error(generatePrefix("FATAL"), ...paramsResolve(params));
    }
    function error(...params) {
        console.error(generatePrefix("ERROR"), ...paramsResolve(params));
    }
    return { info, fatal, error };
})()